import { Tooltip } from "antd";
import { useForm } from "../../framework/common/context/metadata-context";
import "./index.css";

export default function PointWrapper() {
  const { data: tplData } = useForm().root;

  //返回审批要点内容
  function getApprovePoint(text) {
    if (!text) {
      return "暂无审批要点";
    } else {
      return <div dangerouslySetInnerHTML={{ __html: text.replace(/\n/g, "<br>") }}></div>;
    }
  }
  //有审批步骤的是审批页面，否则是发起页面
  if (tplData?.ApproveSteps?.length && tplData?.ApprovePoint && !tplData?.view_mode) {
    return (
      <Tooltip color="white" overlayClassName="mytip approvePoint" placement="rightBottom" trigger="click" title={getApprovePoint(tplData.ApprovePoint)}>
        <div className="point-warp tipWrap-dom on" style={{ marginRight: "550px" }}>
          <span className="approvePoint">审批要点</span>
        </div>
      </Tooltip>
    );
  }

  return null;
}
